const app = getApp();
Page({
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    list:[
        {
          id:'1',
          template:'YS001', //阳上001号模板
          name:'小明',
          amount:100.99,
          type:'ys',
          paid:true
        },
        {
          id:'3',
          template:'YS002', //阳上002号模板
          name:'小明 小红 小王',
          amount:100.99,
          type:'ys',
          paid:true
        },
        {
          id:'4',
          template:'YS003', //阳上003号模板
          name:'小明',
          amount:100.99,
          type:'ys'
        },
        {
          id:'2',
          template:'WS001', //往生001号模板
          name:'小东',
          amount:100.99,
          type:'ws'
        },
        {
          id:'5',
          template:'WS002', //往生001号模板
          name:'小东',
          amount:100.99,
          type:'ws',
          paid:true
        },
        {
          id:'6',
          template:'WS003', //往生001号模板
          name:'小东',
          amount:100.99,
          type:'ws'
        }
  
      ]
  },
methods:{
    switchColor(tl){
        console.log(111)
      switch(tl){
          case 'YS001':
              return 'var(--gradualOrange)'
          break;
      }
    },
},
  showModal(e) {
    this.setData({
      modalName: e.currentTarget.dataset.target
    })
  },
  hideModal(e) {
    this.setData({
      modalName: null
    })
  },
  switchSex: function (e) {
    this.setData({
      skin: e.detail.value
    });
  },

  // ListTouch触摸开始
  ListTouchStart(e) {
    this.setData({
      ListTouchStart: e.touches[0].pageX
    })
  },

  // ListTouch计算方向
  ListTouchMove(e) {
    this.setData({
      ListTouchDirection: e.touches[0].pageX - this.data.ListTouchStart > 0 ? 'right' : 'left'
    })
  },

  // ListTouch计算滚动
  ListTouchEnd(e) {
    if (this.data.ListTouchDirection =='left'){
      this.setData({
        modalName: e.currentTarget.dataset.target
      })
    } else {
      this.setData({
        modalName: null
      })
    }
    this.setData({
      ListTouchDirection: null
    })
  },
  delete(e){
    console.log(e.currentTarget.dataset.delid)
    let nid = e.currentTarget.dataset.delid
    wx.showToast({
        title:'sadf'
    })
  }
})